package cn.gson.work.controller;

import cn.gson.work.model.pojos.Huiyi;
import cn.gson.work.model.service.HuiyisSrevice;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/hyi")
public class HuiyiController {
	@Autowired
	HuiyisSrevice hys;
	@RequestMapping("/sl")
	public List<Huiyi>findAll(){
		List<Huiyi>list=hys.findAll();
		return  list;
	}

	@RequestMapping("/bh")
	public PageInfo<Huiyi>selectbh(String hbm4,String hzt,String sname5,
								   Integer pageNum,Integer pageSize){
		if(pageNum==null)
			pageNum=1;
		if(pageSize==null)
			pageSize=4;
		List<Huiyi> list=hys.selectbh(hbm4,hzt,sname5,pageNum,pageSize);
		PageInfo<Huiyi> pager = new PageInfo<Huiyi>(list);
		return pager;

	}

	@RequestMapping("/add")
	public void addAll(@RequestBody Huiyi huiyi){
		hys.addAll(huiyi);
	}
}

